import clsx from "clsx";

type Opts = {
  width?: number;
  height?: number;
  mirror?: true;
} & React.SVGProps<SVGSVGElement>;

export const createIcon = (
  d: string | React.ReactNode,
  opts: number | Opts = 512,
) => {
  const {
    width = 512,
    height = width,
    mirror,
    style,
  } = typeof opts === "number" ? ({ width: opts } as Opts) : opts;
  return (
    <svg
      aria-hidden="true"
      focusable="false"
      role="img"
      viewBox={`0 0 ${width} ${height}`}
      className={clsx({ "rtl-mirror": mirror })}
      style={style}
    >
      {typeof d === "string" ? <path fill="currentColor" d={d} /> : d}
    </svg>
  );
};

export const excalidrawPlusIcon = createIcon(
  <>
    <path
      d="M72.652 63.598c-1.368.91-1.191 2.833-.953 4.572.702 5.104.47 5.323 1.073 7.016.649 1.826.433 2.553-.08 3.292-.406.588-1.207 1.371-1.906 1.516-.98.204-2.967.01-3.922-.246-.643-.174-1.292-.94-1.598-1.53-.389-.751-1.256-1.951-.694-3.593.56-1.64 1.325-5.374 1.363-6.108.098-1.904.02-3.934-1.085-5.014-1.104-1.082-3.941-1.055-5.739-1.038-1.723.017-3.583 1.207-5.045 1.141-1.343-.061-2.939-.686-3.728-1.536-.79-.852-1.082-2.469-1.007-3.57.074-1.1.726-2.398 1.454-3.033.727-.635 1.91-.867 2.909-.777 1.472.13 4.1 1.342 5.928 1.564 1.67.203 4.016.501 5.04-.227 1.021-.73 1.048-2.717 1.094-4.145.07-2.063-1.021-6.528-.683-8.23.22-1.098 1.709-1.696 2.717-1.979 1.007-.282 2.521-.125 3.328.285.788.398 1.499 1.29 1.516 2.173.031 1.68-1.209 5.66-1.322 7.905-.058 1.133-.61 3.124.482 3.764 1.264.74 2.95 1.778 7.1.673 1.765-.47 3.157-.689 4.62-.622 1.342.06 2.939.685 3.728 1.536.787.85 1.08 2.468 1.006 3.568-.074 1.101-.726 2.4-1.454 3.035-.727.634-1.908.866-2.908.777-1.473-.13-3.164-.68-4.88-1.248-2.526-.835-5.176-.708-6.354.079z"
      fill="currentColor"
    />
    <path
      d="M51.396 25.807c0 .237-.285.474-.617.474-.284 0-1.09 1.328-1.708 2.941-1.897 4.934-20.873 42.46-20.92 41.273 0-.616-.285-1.043-.76-1.043-.664 0-.759.38-.474 2.23.284 2.134.095 2.609-6.642 15.702-3.795 7.448-7.875 15.228-9.06 17.316-1.234 2.182-2.183 4.554-2.278 5.55-.142 1.708.047 1.945 4.175 5.503 2.372 2.088 5.408 4.697 6.736 5.883 5.978 5.456 8.777 7.638 9.536 7.496 1.138-.19 18.739-18.644 18.786-19.688 0-.475-.854-7.685-1.898-16.035-1.802-14.232-3.51-30.884-3.32-32.497.142-.996-.57-6.024-1.092-8.207-.426-1.708-.237-2.42 3.179-10.2 1.992-4.601 4.602-10.247 5.74-12.524 1.091-2.277 2.04-4.27 2.04-4.412 0-.142-.332-.237-.711-.237-.38 0-.712.19-.712.475zM40.485 61.245c.522 3.32 1.565 11.29 2.324 17.695 1.47 11.765 3.179 24.811 3.653 28.132.285 1.66.095 1.992-2.989 5.408-5.36 6.025-11.053 11.955-12.998 13.473l-1.803 1.423-9.25-8.634c-8.54-7.875-9.252-8.681-8.73-9.63.285-.522 2.704-4.934 5.361-9.773 2.657-4.839 6.167-11.29 7.78-14.327 1.66-3.084 3.179-5.74 3.463-5.882.332-.19.427 4.601.332 14.8-.19 15.23-.142 15.277 1.376 14.945.19 0 .332-7.686.332-17.031V74.86l4.981-9.963c2.752-5.503 5.03-9.915 5.124-9.867.095.047.57 2.846 1.044 6.215zM20.228 3.842c-3.51 2.799-8.919 7.543-13.189 11.623l-3.368 3.178.617 4.175c.332 2.277.949 6.736 1.328 9.867.427 3.132.854 6.073.996 6.5.19.57 0 .854-.521.854-.902 0-.95-.237 1.518 7.59.901 2.989 1.755 5.74 1.85 6.025.095.332.474.474.901.332.427-.19.664-.57.522-.901-.142-.38.095-.76.474-.902.522-.19.475-.569-.332-1.945-1.28-2.134-4.554-20.352-4.744-26.234-.142-4.175-.142-4.222 1.613-6.594 1.708-2.325 5.646-5.835 11.718-10.295 1.708-1.28 3.416-2.704 3.89-3.178.712-.854 1.044-.617 7.021 5.74 3.463 3.653 7.306 7.4 8.54 8.35l2.277 1.707-1.756 3.7c-.948 1.993-4.791 9.678-8.586 16.984-7.923 15.37-6.31 13.9-15.513 14.043l-5.978.047-1.992 2.277c-2.088 2.42-2.372 3.32-1.376 4.839.38.522.664 1.376.664 1.898 0 .854.332.996 2.23 1.09 1.186.048 2.277.19 2.42.333.142.142.331 3.083.474 6.547l.19 6.262-3.179 6.831c-5.266 11.386-7.353 16.604-7.353 18.312 0 .901.19 1.66.38 1.66.474 0 .474-.047 19.782-40.324 8.966-18.691 17.458-36.292 18.881-39.185 1.423-2.894 2.704-5.55 2.799-5.93.095-.427-3.178-3.7-8.397-8.303-4.696-4.174-8.824-7.97-9.203-8.396-1.091-1.329-2.704-.902-5.598 1.423zm-2.372 62.147c-.38.996-1.376 3.083-2.183 4.649-1.328 2.656-1.47 2.751-1.802 1.66-.19-.664-.332-2.61-.38-4.364-.047-3.464-.142-3.416 3.843-3.653l1.28-.048-.758 1.756zm3.985-7.59c-2.183 4.221-2.277 4.269-8.255 4.553-5.266.285-5.36.238-5.36-.759 0-.569-.19-1.328-.428-1.708-.284-.426-.094-1.186.57-2.23l1.043-1.612h4.744c2.61-.048 5.598-.237 6.642-.427 1.044-.19 1.945-.285 2.04-.237.095.047-.38 1.138-.996 2.42zm-.19-43.266c-.854.616-1.091 1.233-1.091 2.799 0 1.85.142 2.134 1.423 2.656 1.28.522 1.613.475 3.084-.522 1.945-1.328 1.992-1.66.569-3.795-1.234-1.85-2.467-2.182-3.985-1.138z"
      fill="currentColor"
    />
    <path
      d="M50.141 24.917c.352-.615 1.06-1.085 1.967-1.085.804 0 1.477.34 1.734.597.342.342.477.74.477 1.14 0 .089-.006.305-.119.612-.168.461-1.056 2.337-2.08 4.471-1.131 2.264-3.724 7.875-5.708 12.457-1.671 3.806-2.558 5.881-2.97 7.216-.301.975-.279 1.406-.123 2.032.558 2.33 1.27 7.704 1.122 8.73-.187 1.596 1.537 18.06 3.32 32.136 1.056 8.446 1.91 15.74 1.91 16.22l-.002.07c-.009.184-.087.607-.447 1.14-.506.747-1.932 2.414-3.805 4.476-4.242 4.672-10.806 11.46-13.673 14.059-.682.617-1.199 1.023-1.472 1.182a1.872 1.872 0 01-.612.236c-.41.077-1.225-.015-2.35-.737-1.495-.959-4.19-3.217-8.46-7.114-1.327-1.184-4.36-3.79-6.718-5.865-1.712-1.476-2.767-2.405-3.411-3.096-.677-.727-.994-1.291-1.16-1.839-.165-.544-.18-1.09-.117-1.847.104-1.1 1.103-3.737 2.466-6.15 1.182-2.08 5.247-9.833 9.031-17.26 3.34-6.491 5.06-9.853 5.906-11.859.677-1.603.696-2.113.587-2.93-.18-1.168-.195-1.884-.111-2.308.1-.511.321-.851.58-1.1.346-.331.813-.55 1.488-.55.199 0 .391.024.574.07 4.068-7.268 18.093-35.143 19.705-39.334.585-1.53 1.353-2.823 1.794-3.288.228-.24.462-.39.677-.482zM38.72 59.573a448.835 448.835 0 00-3.06 5.995l-4.823 9.646v16.63c0 8.501-.124 15.643-.287 16.987-.142 1.166-1.002 1.462-1.384 1.526l.16-.017c-.671.147-1.214.135-1.647-.047-.495-.209-1.058-.629-1.33-1.813-.332-1.439-.336-5.202-.22-14.563.04-4.272.047-7.59.016-9.984-.33.582-.666 1.188-.986 1.783-1.615 3.04-5.13 9.5-7.79 14.345-2.383 4.34-4.576 8.338-5.207 9.493.131.186.356.489.61.77 1.165 1.287 3.451 3.428 7.667 7.316l8.316 7.76.798-.63c1.917-1.495 7.517-7.35 12.808-13.295.898-.995 1.544-1.72 2-2.29.37-.464.594-.76.675-1.06.067-.247.004-.478-.051-.8l-.007-.041c-.475-3.324-2.184-16.382-3.657-28.168-.757-6.384-1.797-14.328-2.317-17.639l-.004-.023c-.089-.635-.185-1.272-.28-1.881zM19.289 2.67c1.673-1.343 3-2.096 4.04-2.364 1.537-.394 2.687.004 3.621 1.119.396.44 4.46 4.165 9.071 8.264 4.274 3.769 7.265 6.676 8.244 7.909.69.868.68 1.598.625 1.844-.002.013-.006.026-.009.038-.1.398-1.416 3.195-2.908 6.228-1.423 2.893-9.912 20.488-18.875 39.173C7.581 97.252 4.465 103.75 3.6 105.058c-.497.751-.885.854-1.111.924a1.729 1.729 0 01-.526.076c-.42 0-.964-.148-1.368-.767-.223-.342-.511-1.288-.511-2.394 0-.606.19-1.592.67-3.03.955-2.866 3.1-7.864 6.821-15.911l3.03-6.513-.178-5.89a153.908 153.908 0 00-.33-5.346c-.352-.041-.773-.081-1.14-.096-.98-.049-1.616-.131-2.03-.261-.645-.204-1.016-.535-1.267-.928-.221-.348-.358-.79-.358-1.4 0-.282-.173-.735-.377-1.016l-.04-.059c-.621-.945-.859-1.757-.79-2.608.085-1.023.72-2.222 2.283-4.034l1.607-1.836c-.218-.687-.996-3.199-1.807-5.89-1.558-4.942-2.122-6.841-2.152-7.56-.034-.83.282-1.245.57-1.51a1.53 1.53 0 01.406-.265c-.217-1.235-.55-3.498-.875-5.878a488.89 488.89 0 00-1.323-9.829l-.617-4.175a1.5 1.5 0 01.455-1.31l3.361-3.172c4.301-4.11 9.749-8.888 13.287-11.709zm-3.879 71.31c-.31.283-.612.394-.858.441a1.547 1.547 0 01-1.04-.132l.103 3.418v.018l1.795-3.746zm12.426 1.473a23.55 23.55 0 01-.225.553 43.912 43.912 0 01-.763 1.686c.328-.11.65-.094.966.015l.022.008v-2.262zm1.524-3.996l-.032.037a1.575 1.575 0 01-.862.5c.042.411.057.798 0 1.25l.894-1.787zM16.286 65.87c-.566.056-1.034.117-1.267.149-.014.118-.03.275-.035.408-.012.4-.001.889.007 1.466.006.237.014.477.024.716.49-.997.97-2.02 1.271-2.739zm4.486-3.076a4.31 4.31 0 01-.88.654c.136.22.21.469.22.721l.281-.585.38-.79zm-.299-5.017c-1.381.168-3.98.324-6.29.365h-3.956l-.594.92c-.19.298-.36.7-.429.874.215.444.399 1.073.478 1.666h.014c.771.012 1.964-.048 3.819-.148 2.63-.125 3.979-.11 4.898-.616.326-.18.561-.453.817-.83.374-.551.75-1.276 1.243-2.23zm4.52-3.77a6.345 6.345 0 01-1.098.892c.156.141.3.333.383.595l.714-1.487zm15.241-3.122c-.47.934-.941 1.866-1.41 2.789.6-.264 1.192-.034 1.288.014.079.04.308.15.517.425a27.335 27.335 0 00-.224-1.044c-.185-.74-.289-1.336-.17-2.184zM24.148 5.38c-.758.673-2.198 1.856-3.649 2.944-5.896 4.33-9.738 7.717-11.4 9.978-.594.803-.97 1.279-1.177 1.801-.316.802-.217 1.685-.143 3.852.132 4.065 1.762 14.092 3.157 20.466.555 2.535 1.023 4.46 1.383 5.059.528.9.771 1.5.842 1.889.088.484.016.86-.118 1.167a1.86 1.86 0 01-.27.446l2.687-.021c1.825-.028 3.22.008 4.349-.038.897-.038 1.587-.111 2.187-.396.71-.336 1.26-.968 1.948-2.018 1.313-2.003 2.904-5.314 5.721-10.782 3.785-7.286 7.618-14.95 8.563-16.935l1.23-2.593-1.311-.984c-1.258-.967-5.182-4.782-8.717-8.51-2.604-2.769-4.52-4.608-5.282-5.325zm-11.86 47.181l-.001-.003-.026-.064.027.067zm-1.503-1.764l.059-.024a1.07 1.07 0 00-.059.024zm42.106-24.884l-.002.022.001-.009.001-.013zm.003-.035l.002-.071-.002.071zM20.773 13.917c-1.241.896-1.713 1.74-1.713 4.015 0 1.663.252 2.444.727 3.002.334.391.822.714 1.63 1.043.743.303 1.275.437 1.771.44.735.005 1.457-.254 2.72-1.109 1.495-1.02 2.072-1.825 2.19-2.615.111-.744-.188-1.715-1.214-3.254-.872-1.307-1.805-2.006-2.727-2.266-1.036-.292-2.15-.105-3.356.723l-.028.02zm4.263 4.285c-.128-.242-.375-.69-.648-1.099-.4-.598-.691-1.03-1.123-1.056-.24-.015-.473.123-.744.308-.461.337-.461.721-.461 1.577 0 .417.04.883.058 1.064.1.052.282.142.431.203.283.115.47.216.66.218.084 0 .152-.057.255-.113.215-.115.46-.275.757-.476.311-.213.632-.472.815-.626zM19.293 2.669l-.005.003.005-.003z"
      fill="currentColor"
    />
  </>,
  { width: 89, height: 131, style: { transform: "translateX(4px)" } },
);
